{include file="public/layout"/}

<body data-type="generalComponents">
<div class="tpl-content-wrapper js-check-wrap">
    <ol class="am-breadcrumb">
        <li><a href="javascript:void(0)" onclick="javascript:parent.openItem('welcome|Index');" class="am-icon-home">首页</a></li>
        <li class="am-active">数据</li>
        <li class="am-active">数据备份</li>
    </ol>
    <div class="tpl-portlet-components">
        <div class="tpl-block">
            <div class="am-g tpl-amazeui-form">
                <div class="am-u-sm-12 am-u-md-9">
                    <div class="am-form-group">
                        <label class="am-u-sm-4 am-form-label">上传图片</label>
                        <div class="am-u-sm-4" style="float: left">
                            <button type="button" class="am-btn am-btn-danger am-btn-sm" id="btn">
                                <i class="am-icon-cloud-upload"></i> 选择要上传的文件
                            </button>
                        </div>
                        <div class="am-u-sm-8">
                            <ul id="ul_pics" class="am-avg-sm-4 am-thumbnails"></ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="__STATIC__/js/plupload/plupload.full.min.js"></script>
<script src="__ADMIN__/js/admin.js"></script>
<script src="__STATIC__/js/plupload.js"></script>
<script type="text/javascript">
    upload({
        url: "{:url('Uploadify/upload')}",
        browse_button: 'btn',
        max_file_size: '2mb', //最大上传文件大小（格式100b, 10kb, 10mb, 1gb）
        multi_selection: true, //true:ctrl多文件上传, false 单文件上传
        max_length: 4, //最大上传数量
        //上传成功
        uploadSuccessCallBack: function(up, file, info) {
            var data = JSON.parse(info.response);
            if (data.code == 1) {
                $("#" + file.id).html("<img class='am-thumbnail' src='" + data.pic + "'/>");
            }else {
                $("#" + file.id).remove();
                alert(data.msg);
            }
        },
        //上传失败回调
        uploadErrorCallBack : function(up, err) {
            alert(err.message);
        }
    });
</script>
</body>
</html>